package apache.file;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

/**
 * @Author hujian
 * @Date 2021/10/6 18:13
 * @Description description
 */
public class TestIterator {
    public static void main(String[] args) throws IOException {

        final LineIterator it = FileUtils.lineIterator(new File("/root/res.txt"), "UTF-8");
        try {
            while (it.hasNext()) {
                final String line = it.nextLine();
                System.out.println(line);
            }
        } finally {
            it.close();
        }
    }

    @Test
    public void test1(){

    }
}
